#include <assert.h>

#include <cstddef>
#include <iostream>
#include <queue>
#include <type_traits>

class MyStack {
 public:
  MyStack() : queue_() {}
  virtual ~MyStack() = default;

  void push(int x) { queue_.push(x); }

  bool empty() { return queue_.empty(); }

  int top() {
      auto sz = queue_.size();
      forx
    for (auto i = sz - 1; i > 0; --i) {
      queue_.push(queue_.front());
      queue_.pop();
    }
    int val = queue_.front();
    queue_.pop();
    queue_.push(val);
    return val;
  }

  int pop() {
    auto sz = queue_.size();
    for (auto i = sz - 1; i > 0; --i) {
      queue_.push(queue_.front());
      queue_.pop();
    }
    int val = queue_.front();
    queue_.pop();
    return val;
  }

 private:
  std::queue<int> queue_;
};
